﻿using J.Model;
using J.ProductGet.Application.Command.ClassifiedManagementCommand;
using MediatR;
using SqlSugar;

namespace J.ProductGet.Application.CommandHandler.ClassifiedManagementCommandHandler
{
    public class ManagementGetCommandHandler : IRequestHandler<ManagementGetCommand, List<ClassifiedManagement>>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public ManagementGetCommandHandler(ISqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }
        public async Task<List<ClassifiedManagement>> Handle(ManagementGetCommand request, CancellationToken cancellationToken)
        {
            var list = await _sqlSugarClient.Queryable<ClassifiedManagement>().ToListAsync();
            return list;
        }
    }
}
